Use [abyx_svcm]
GO

--[SP_STK_EquipmentSparepartsGet]
IF  EXISTS (SELECT * 
			FROM dbo.sysobjects 
			WHERE id = OBJECT_ID(N'[SP_STK_EquipmentSparepartsGet]') 
			AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE [SP_STK_EquipmentSparepartsGet]
GO
/****** Object:  StoredProcedure [dbo].[SP_STK_EquipmentSparepartsGet]    Script Date: 2012-08-12 16:38 ******/
CREATE PROCEDURE [dbo].[SP_STK_EquipmentSparepartsGet]
	 @EquipmentSparesId uniqueidentifier
AS
BEGIN
	SELECT * FROM [STK_EquipmentSpareparts] WHERE [EquipmentSparesId]=@EquipmentSparesId
	RETURN @@error
END
GO

--[SP_STK_EquipmentSparepartsInsert]
IF  EXISTS (SELECT * 
			FROM dbo.sysobjects 
			WHERE id = OBJECT_ID(N'[SP_STK_EquipmentSparepartsInsert]') 
			AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE [SP_STK_EquipmentSparepartsInsert]
GO
/****** Object:  StoredProcedure [dbo].[SP_STK_EquipmentSparepartsInsert]    Script Date: 2012-08-12 16:38 ******/
CREATE PROCEDURE [SP_STK_EquipmentSparepartsInsert]
	 @EquipmentSparesId uniqueidentifier	,@SparesStockId uniqueidentifier	,@EquipmentId uniqueidentifier	,@LMUserId uniqueidentifier	,@LMDate datetimeAS
BEGIN
	INSERT INTO [STK_EquipmentSpareparts]
		 VALUES( @EquipmentSparesId,@SparesStockId,@EquipmentId,@LMUserId,@LMDate)
	RETURN @@error
END
GO

--[SP_STK_EquipmentSparepartsUpdate]
IF  EXISTS (SELECT * 
			FROM dbo.sysobjects 
			WHERE id = OBJECT_ID(N'[SP_STK_EquipmentSparepartsUpdate]') 
			AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE [SP_STK_EquipmentSparepartsUpdate]
GO
/****** Object:  StoredProcedure [dbo].[SP_STK_EquipmentSparepartsUpdate]    Script Date: 2012-08-12 16:38 ******/
CREATE PROCEDURE [dbo].[SP_STK_EquipmentSparepartsUpdate]
	 @EquipmentSparesId uniqueidentifier	,@SparesStockId uniqueidentifier	,@EquipmentId uniqueidentifier	,@LMUserId uniqueidentifier	,@LMDate datetimeAS
BEGIN
	UPDATE [STK_EquipmentSpareparts]
	   SET
			 [SparesStockId] = @SparesStockId			,[EquipmentId] = @EquipmentId			,[LMUserId] = @LMUserId			,[LMDate] = @LMDate	WHERE [EquipmentSparesId] = @EquipmentSparesId
	RETURN @@error
END
GO

--[SP_STK_EquipmentSparepartsDelete]
IF  EXISTS (SELECT * 
			FROM dbo.sysobjects 
			WHERE id = OBJECT_ID(N'[SP_STK_EquipmentSparepartsDelete]') 
			AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE [SP_STK_EquipmentSparepartsDelete]
GO
/****** Object:  StoredProcedure [dbo].[SP_STK_EquipmentSparepartsDelete]    Script Date: 2012-08-12 16:38 ******/
CREATE PROCEDURE [dbo].[SP_STK_EquipmentSparepartsDelete]
	@EquipmentSparesId uniqueidentifier
AS
BEGIN
	DELETE FROM [STK_EquipmentSpareparts] WHERE [EquipmentSparesId]=@EquipmentSparesId
	RETURN @@error
END
Go

